<!--
 * @Author: zhaozhehao zhaozhehao@erayt.com
 * @Date: 2023-09-04 13:33:07
 * @LastEditors: SilentWaver silentwaver.code@gmail.com
 * @LastEditTime: 2024-02-26 16:59:14
 * @Description: 
 * 
-->
<template>
    <div>
        <n-form ref="formRef" inline :label-width="80" :model="formValue" >
            <n-form-item label="appName" path="name">
                <n-input v-model:value="formValue.name" placeholder="" />
            </n-form-item>
            <n-form-item label="url" path="url">
                <n-input v-model:value="formValue.url" placeholder="" />
            </n-form-item>
            <n-form-item label="icon" path="icon">
                <n-input v-model:value="formValue.icon" placeholder="" />
            </n-form-item>

        </n-form>
        <div>
            <n-button strong secondary round type="primary" @click="install">
                install
            </n-button>
            <n-button strong secondary round @click="cancelInstall">
                cancel
            </n-button>
        </div>
    </div>
</template>
<script>
export default {
    data(){
        return {
            formValue:{
                name: '',
                url:'',
                icon:'',
            }
        }
    },
    methods: {
        install() {
            console.log(this.formValue)
            const list = JSON.parse(localStorage.getItem("appList")) || [];
            list.push({...this.formValue})
            localStorage.setItem("appList", JSON.stringify(list));
            this.$router.replace({ name: 'desktop' })
         },
        cancelInstall() {
            this.$router.replace({ name: 'desktop' })
        }
    }
}
</script>
<style lang="less"></style>